package com.glepoch.springbootsecuritymybatis.compoment.execption;

import com.glepoch.springbootsecuritymybatis.compoment.constant.statuscode.BaseStatusEnum;

import java.io.Serializable;
/**
 *
 *
 *@description: 自定义异常基类
 *@author: ygl
 *@time:
 *
 */
public abstract class BaseExecption extends RuntimeException implements Serializable {
    private int code;
    private Object attach;


    public BaseExecption(int code, String message) {
        super(message);
        this.code = code;
    }

    public BaseExecption(BaseStatusEnum definition) {
        super(definition.getMessage());
        this.code = definition.getCode();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public BaseExecption attach(Object attach) {
        this.attach = attach;
        return this;
    }

}
